import request from '@/utils/request'
// import { setToken } from '@/utils/storage'
import { SET_USERINFO } from '../actionTypes'
export const getUseInfo = () => {
  return async (dispatch) => {
    // 1. ajax
    const res = await request({
      url: '/user',
      method: 'GET'
    })
    console.log(res)

    // 2. 保存结果到redux
    dispatch({ type: SET_USERINFO, payload: res.data })
    // 3. token持久化
    // setToken(res.data.token)
  }
}
